<template>
  <div class="module-wrap">
    <div class="header">
      <div class="header-content">
        <div class="title">{{ title }}</div>
        <slot name="header"></slot>
      </div>
    </div>
    <div
      class="module-content flex-1"
      :style="{
        ...moduleStyle,
        backgroundImage: moduleStyle.backgroundImage
          ? moduleStyle.backgroundImage
          : `url('/static/screen/module-wrap-bg.png')`,
      }"
    >
      <slot />
    </div>
  </div>
</template>

<script setup lang="tsx">
defineProps({
  title: {
    type: String,
    default: '',
  },
  moduleStyle: {
    type: Object,
    default: () => ({
      // backgroundImage: `url('/static/screen/module-wrap-bg.png')`,
    }),
  },
});
</script>

<style lang="scss" scoped>
.module-wrap {
  pointer-events: all;

  .header {
    --width: 100%;
    --height: 26px;

    position: relative;
    width: var(--width);
    height: var(--height);

    .header-content {
      position: absolute;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 16px;
      color: #fff;
      padding: 0 24px 0 24px;
      width: var(--width);
      height: var(--height);
      top: 0;
      left: 0;
      font-size: 0.8vw;
      background: url('/static/screen/module-title.png') no-repeat;
      background-size: contain;
      background-position: left bottom;

      .title {
        background: linear-gradient(
          180deg,
          rgba(255, 255, 255, 1) 0%,
          rgba(99, 208, 255, 1) 100%
        );
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
  }

  .module-content {
    padding: 18px 18px;
    display: flex;
    align-items: center;
    // justify-content: center;
    flex-direction: column;
    height: 100%;
    // background-image: url('/static/screen/module-wrap-bg.png');
    background-size: 100% 100%;
  }
}
</style>
